<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script>

function loginDigBind(){
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(500);	
		$('#mask').fadeTo("slow",0.4);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1000); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
	$("#loginemail").val("");
	$("#loginyhmm").val("");
}

function clickExit(){
    $.ajax({
	    url: "exitYhxx.action",
	    type: "post",
	    success: function() {
	    	window.location.reload(); 
	     }
	 });
}
function clickLogin(){//点击登录触发的函数
	var email=$("#loginemail");
	var yhmm=$("#loginyhmm");
    $.ajax({
	    url: "loginYhxx.action",
	    type: "post",
	    data: "email="+email.val()+"&yhmm="+yhmm.val(),
	    datetype: "json",
	    success: function(date) {
	    	var flag=date.flag;
	    	if(flag=="0"){
	    		alert("登录失败");
	    	}
	    	if(flag=="1"){
	    		window.location.reload(); 
	    	}
	    	
	     }
	 });
}

</script>
<style>
#mask {
  position:absolute;
  left:0;
  top:0;
  z-index:9000;
  background-color:#000;
  display:none;
}
  
#boxes .window {
  position:absolute;
  left:0;
  top:0;
  width:440px;
  height:200px;
  display:none;
  z-index:9999;
  padding:20px;
}

#boxes #dialog {
  width:375px; 
  height:203px;
  padding:10px;
  background-color:#ffffff;
}

#boxes #dialog1 {
  width:375px; 
  height:203px;
}

#dialog1 .d-header {
  background:url(images/login-header.png) no-repeat 0 0 transparent; 
  width:375px; 
  height:150px;
}

#dialog1 .d-header input {
  position:relative;
  top:60px;
  left:20px;
  border:3px solid #cccccc;
  height:22px;
  width:200px;
  font-size:15px;
  padding:5px;
  margin-top:4px;
}
#dialog1 .d-header label{
  position:relative;
  top:60px;
  }
#dialog1 .d-blank {
  float:left;
  background:url(images/login-blank.png) no-repeat 0 0 transparent; 
  width:267px; 
  height:53px;
}

#dialog1 .d-login {
  float:left;
  width:108px; 
  height:53px;
}

#boxes #dialog2 {
  background:url(images/notice.png) no-repeat 0 0 transparent; 
  width:326px; 
  height:229px;
  padding:50px 0 20px 25px;
}
</style>

<div id="boxes">


  
<!-- Start of Login Dialog -->  
<div id="dialog1" class="window">
  <div class="d-header">
   <label> E-mail：</label><input id="loginemail" type="text" value="username"/><br/>
   <label>密&nbsp;&nbsp;码：</label><input  id="loginyhmm"type="password" value="Password" />    
  </div>
  <div class="d-blank"></div>
  <div class="d-login"><input onclick="clickLogin()" type="image" alt="Login" title="Login" src="images/login-button.png"/></div>
</div>
<!-- End of Login Dialog -->  

<!-- Mask to cover the whole screen -->
  <div id="mask"></div>
</div>


